﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.UI.DataVisualization.Charting;

using TestEnvirementCL.POCO;
using TestEnvirementCL.Concrete;
using System.IO;
using System.Reflection;

namespace TestEnvirementMVC.Controllers
{
  public class HomeController : Controller
  {
    EFDbContext isfDB = new EFDbContext();
    public ActionResult Index()
    {
      var countries = isfDB.Countries.ToList<Country>();
      var regions = isfDB.Regions.ToList<Region>();

      MyChart test = new MyChart();
      String startupPath = Assembly.GetAssembly(typeof(MyChart)).Location;
      test.initialiseDataSerieArray(countries.Count);
      for (int i = 0; i < countries.Count; i++)
      {
        test.countPerName[i] = test.nieuweRij(countries[i].Name, countries[i].Regions.Count);
      }
      ViewBag.ListCountry = test.countPerName;
      ViewBag.ListRegions = regions;
      ViewBag.ListCountries = countries;
      ViewBag.Message = "Google Charts Graphs";

      return View();
    }

   
  }
}
